# $Id: PKGBUILD 87516 2013-04-02 00:52:49Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=ubuntuone-control-panel
pkgver=4.2.0
pkgrel=1
pkgdesc="Graphical user interface that allows the users to manage their Ubuntu One subscription and preferences"
arch=('any')
url="https://launchpad.net/ubuntuone-control-panel"
license=('GPL')
depends=('ubuntuone-client')
makedepends=('python2-distutils-extra')
source=(https://launchpad.net/ubuntuone-control-panel/stable-4-2/$pkgver/+download/$pkgname-$pkgver.tar.gz)
md5sums=('19afeb2cf7090c1bef0f12ed0c35942d')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # Python2 fix
  sed -i 's@^#!.*python$@#!/usr/bin/python2@' bin/*

  # Fix desktop file
  sed -i 's/^Categories=.*/Categories=Qt;Network;FileTransfer/' ubuntuone-installer.desktop.in
  sed -i '/^NotShowIn=/d' ubuntuone-installer.desktop.in

  python2 setup.py build
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  python2 setup.py install --root=$pkgdir/ --optimize=1

  # We don't have Apport in Arch Linux
  rm -r "$pkgdir"/usr/share/apport

  # Remove unneeded files
  rm "$pkgdir"/usr/share/ubuntuone-control-panel/*.ttf
  rm "$pkgdir/usr/share/applications/ubuntuone-control-panel-qt-gnome.desktop"
}
